# from __future__ import absolute_import, unicode_literals
# from celery import shared_task
# from utils.my_mail import my_send_mail
# from music_lzz.settings import EMAIL_HOST_USER
#
# @shared_task
# def reg_send_mail(title, context, EMAIL_HOST_USER, to_email):
#     res = my_send_mail(title, context, EMAIL_HOST_USER, to_email)
#     success_context = '向{}发送邮箱成功，内容为{}'.format(to_email, context)
#     fail_context = '向{}发送邮件失败'.format(to_email)
#     if res == 1:
#         return success_context
#     return fail_context
#


# Create your tasks here
from __future__ import absolute_import, unicode_literals
from celery import shared_task
from utils.my_mail import my_send_mail


@shared_task
def reg_send_mail(title, context, from_email, to_email):
    res = my_send_mail(title, context, from_email, to_email)

    success_context = '向{}邮箱发送注册验证码成功,信息内容:{}'.format(to_email, context)
    fail_context = "向{}发送邮箱验证码失败".format(to_email)

    if res == 1:
        return success_context
    return fail_context
